<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@  taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html lang="en">
<%@ include file="common/head.jsp"%>

<body class="fix-header fix-sidebar">
	<!-- Preloader - style you can find in spinners.css -->
	<div class="preloader">
		<svg class="circular" viewBox="25 25 50 50">
				<circle class="path" cx="50" cy="50" r="20" fill="none"
				stroke-width="2" stroke-miterlimit="10" /> </svg>
	</div>
	<!-- Main wrapper  -->
	<div id="main-wrapper">
		<!-- header header  -->
		<%@ include file="common/header.jsp"%>
		<!-- End header header -->
		<!-- Left Sidebar  -->
		<%@ include file="common/nav.jsp"%>
		<!-- End Left Sidebar  -->
		<!-- Page wrapper  -->
		<div class="page-wrapper">
			<!-- 锐高软件 -->
			<%@ include file="../common/ruigao.jsp"%>

			<!--
                    	作者：offline
                    	时间：2018-03-26
                    	描述：查看信息
                    -->
			<div class="container-fluid">
				<!-- Start Page Content -->
				<div class="row justify-content-center">
					<div class="col-12">
						<div class="card">
							<div class="card-body">
								<div class="card-content">
									<!-- Left sidebar -->
									<div class="inbox-leftbar">
										<a class="btn btn-danger btn-block waves-effect waves-light"
											href="${pageContext.request.contextPath}/indexServlet"> <font
											style="vertical-align: inherit;"> <font
												style="vertical-align: inherit;">返回首页</font>
										</font>
										</a>

									</div>

								</div>
								<!-- End Left sidebar -->

								<div class="inbox-rightbar">

									<div role="toolbar">
										<div class="btn-group">
											<button class="btn btn-light waves-effect" type="button">
												<i class="mdi mdi-archive font-18 vertical-middle"></i>
											</button>
											<button class="btn btn-light waves-effect" type="button">
												<i class="mdi mdi-alert-octagon font-18 vertical-middle"></i>
											</button>
											<button class="btn btn-light waves-effect" type="button">
												<i class="mdi mdi-delete-variant font-18 vertical-middle"></i>
											</button>
										</div>

										<div class="btn-group">
											<button aria-expanded="false" data-toggle="dropdown"
												class="btn btn-light dropdown-toggle waves-effect"
												type="button">
												<font style="vertical-align: inherit;"><font
													style="vertical-align: inherit;"> 部门 </font></font><span
													class="caret m-l-5"></span>

											</button>
											<div class="dropdown-menu showdepart"></div>
										</div>
										<%@ include file="../listall/companyall.jsp"%>

										<div class="btn-group show">
											<button aria-expanded="false" data-toggle="dropdown"
												class="btn btn-light dropdown-toggle waves-effect"
												type="button">
												<font style="vertical-align: inherit;"><font
													style="vertical-align: inherit;"> 公司 </font></font><span
													class="caret m-l-5"></span>
											</button>
											<div class="dropdown-menu ">
												<c:forEach var="company" items="${selectcompany}">
													<a title="${company.companyId}"
														class="dropdown-item company">${company.companyName}</a>
												</c:forEach>
											</div>
										</div>
										<input type="hidden" name="opt" id="opt" value=""> <input
											type="hidden" name="companyids" id="companyids"
											value="${companyid}">
									</div>
									<div class="table-responsive">
										<table class="table">
											<thead>
												<tr>

													<th><font style="vertical-align: inherit;"> <font
															style="vertical-align: inherit;">姓名</font>
													</font></th>
													<th><font style="vertical-align: inherit;"> <font
															style="vertical-align: inherit;">性别</font>
													</font></th>
													<th><font style="vertical-align: inherit;"> <font
															style="vertical-align: inherit;">手机号</font>
													</font></th>
													<th><font style="vertical-align: inherit;"> <font
															style="vertical-align: inherit;">职位</font>
													</font></th>
													<th><font style="vertical-align: inherit;"> <font
															style="vertical-align: inherit;">操作</font>
													</font></th>
												</tr>
											</thead>
											<tbody id="tbody">
												<c:forEach items="${PageInfo}" var="us">
													<tr>
														<td><font style="vertical-align: inherit;"> <font
																style="vertical-align: inherit;"> ${us.userName}
															</font></font></td>

														<td><font style="vertical-align: inherit;"> <font
																style="vertical-align: inherit;"> <c:if
																		test="${us.userSex eq 1}">
													  男
													  </c:if> <c:if test="${us.userSex eq 2}">
													  女
													  </c:if>

															</font></font></td>

														<td><font style="vertical-align: inherit;"> <font
																style="vertical-align: inherit;">${us.userPhone}</font></font>

														</td>

														<td><span> <font
																style="vertical-align: inherit;"> <font
																	style="vertical-align: inherit;">${us.userPosition}</font></font>
														</span></td>

														<td>
															<button type="button"
																class="btn btn-success btn-sm btn-rounded m-b-2 m-l-5">
																<a
																	href="${pageContext.request.contextPath}/userattendancelist?userid=${us.userId}&opt=useridshow"
																	style="color: white;">查看考勤</a>
															</button>

														</td>


													</tr>

												</c:forEach>


											</tbody>
										</table>
									</div>
									<!--上一页--下一页-->
									<div class="table-responsive m-t-40">
										<div id="example23_wrapper" class="dataTables_wrapper">
											<div class="dataTables_paginate paging_simple_numbers"
												id="example23_paginate" id="pageshow">

												<a href="?PageNo=1" class="paginate_button"
													aria-controls="example23" data-dt-idx="7" tabindex="0"
													id="example23"> <font style="vertical-align: inherit;">
														<font style="vertical-align: inherit;"></font>首页
												</font>
												</a>
												<c:if test="${page.getHasPrevPage() }">
													<a
														href="deptuserinfo?PageNo=${page.getPrevPage() }&opt=selectpartuser&departid=${departid}&companyidmoren=${companyid}"
														class="paginate_button previous disabled"
														aria-controls="example23" data-dt-idx="0" tabindex="0"
														id="example23_previous"><font
														style="vertical-align: inherit;"><font
															style="vertical-align: inherit;">上一页</font></font> <input
														type="hidden" id="departid" name="DeparTid" value="">

													</a>
												</c:if>
												<span> 
												<c:forEach items="${page.getGroupPage()}"
														var="pageI">
														<a href="?PageNo=${pageI}&departid=${departid}&companyidmoren=${companyid}" class="paginate_button"
															aria-controls="example23" data-dt-idx="7" tabindex="0"
															id="example23"> <font
															style="vertical-align: inherit;"> <font
																style="vertical-align: inherit;">${pageI }</font></font>
														</a>
													</c:forEach>
												</span>

												<c:if test="${page.getHasNextPage() }">
													<a
														href="deptuserinfo?PageNo=${page. getNextPage()}&opt=selectpartuser&departid=${departid}&companyidmoren=${companyid}"
														class="paginate_button next" aria-controls="example23"
														data-dt-idx="7" tabindex="0" id="example23_next"><font
														style="vertical-align: inherit;"><font
															style="vertical-align: inherit;">下一页</font></font> <input
														type="hidden" id="departidd" name="DeparTid" value="">
													</a>
												</c:if>
												<a href="?PageNo=${page.getTotalPage()}&departid=${departid}&companyidmoren=${companyid}"
													class="paginate_button" aria-controls="example23"
													data-dt-idx="7" tabindex="0" id="example23"> <font
													style="vertical-align: inherit;"> <font
														style="vertical-align: inherit;"></font>末页
												</font>
												</a>
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!-- footer -->
	<%@ include file="common/footer.jsp"%>
	<!-- End footer -->
	<%@ include file="common/js.jsp"%>
	<!--
        	作者：offline
        	时间：2018-04-09
        	描述：点击删除按钮弹窗
        -->

	<script type="text/javascript">
		$(function() {
			//判断当前登录的员工的权限
			var competence = ${competence};
			if(competence!=3){
				$(".show").html("");
			}
			//初始化公司
			$("#opt").val("showdepart");
			var companyidmoren = parseInt($("#companyids").val());
			var opt = $("#opt").val();
			$.ajax({
				url : "deptuserinfo",
				data : {
					"companyidmoren" : companyidmoren,
					"opt" : opt
				},
				type : "GET",
				dataType : "JSON",
				success : function(data) {
					$(".showdepart").text("");
					for ( var i in data) {
						$(".showdepart").append(
								"<a href='deptuserinfo?departid="+data[i].deptId+"' class='dropdown-item part'>"
										+ data[i].deptName + "</a>");

					}
				},
				error : function(data) {
					swal({
						title : '操作失败！',
						type : 'error',
						confirmButtonText : '确定',
						closeOnConfirm : false
					});
				}
			});

			//点击公司事件
			$(".company")
					.click(
							function() {
								$("#opt").val("showdepartlist");
								var companytid = $(this).attr('title');
								$("#companyids").val(companytid);
								var companyidmoren = $("#companyids").val();
								var opt = $("#opt").val();

								$.ajax({
											url : "deptuserinfo",
											data : {
												"companyidmoren" : companyidmoren,
												"opt" : opt
											},
											type : "GET",
											dataType : "JSON",
											success : function(data) {
												$(".showdepart").text("");
												for ( var i in data) {
													$(".showdepart")
															.append(
																	"<a href='deptuserinfo?departid="
																			+ data[i].deptId
																			+ "' class='dropdown-item part'>"
																			+ data[i].deptName
																			+ "</a>");
												}

											},
											error : function(data) {
												swal({
													title : '操作失败！',
													type : 'error',
													confirmButtonText : '确定',
													closeOnConfirm : false
												});
											}
										});
							});

		});
	</script>
</body>

</html>